<h1> Users List</h1>


<script type="text/javascript">
$(function() {
    $("a.user-delete").click(function(e){
         parent_row = $(this).parent().parent();
         id = parent_row.attr('id');
         $.getJSON("/en/user/account/delete-user", {'id': id},
            function(json) {
               alert(json.success);
               if (json.success)
                    parent_row.css("background-color", 'red').fadeOut(1000);
               else
                    alert(json.message);
            });
         return false;
    });
    

    $("table.roleList tr:nth-child(odd)").addClass("striped");

    $("tr").mouseover(function(e){
                        jQuery(this).find(".tr-action").show();
                }).mouseout(function(){
                        jQuery(this).find(".tr-action").hide();
                });
});

</script>

<table class="roleList">
<tr style="background-color:#EEEEEE; height:20px">
<td style="text-align:center"><b style="font-size:16px;color:red">id</b></td>
<td style="text-align:center"><b style="font-size:16px;color:red">Name</b></td>
<td style="text-align:center"><b style="font-size:16px;color:red">Mail</b></td>
<!--<td>Status</td>-->
<td style="text-align:center"><b style="font-size:16px;color:red">Roles</b></td>
<td style="text-align:center"><b style="font-size:16px;color:red">Operator</b></td>
</tr>
<?foreach ($this->userList as $user) :?>
	  <tr id="<?=$user['id']?>" class="user-row">
	    <td width="5%"><?=$user['id'] ?></td>
	    <td width="10%"> <b><a href="/en/user/account/view?id=<?=$user['id'] ?>"><?= $user['name']?></a></b></td>
	    <td width="15%"> <b><?= $user['mail']?></b></td>
	    <!--<td width="20%"> <b></?= $user['status']?></b></td>-->
	    <td><?=$this->userRoles[$user['id']] ?></td>
	    
	    <td width="25%">
		    <a href="/en/user/account/change-pass?id=<?=$user['id']?>">Pwd</a> |
		    <a href="/en/user/account/edit?id=<?=$user['id']?>">edit</a> |
		    <a href="javascript:void()" class="user-delete">delete</a>
		    <a href="/en/user/admin/assign-roles?uid=<?=$user['id']?>&uname=<?=$user['name']?>">roles</a></td>  
		</td>
	  </tr>
<?endforeach?>
</table>
<br />
<div style="width:100%;float: right" id = "paging">
<?= $this->paginationControl($this->paginator, 'Sliding', 'en/search/my_pagination_control.phtml'); ?>
</div>
<br/>
